package edu.neu.cs6515.player;

import java.util.List;

import com.google.java.contract.Ensures;
import com.google.java.contract.Requires;

import edu.neu.cs6515.player.strategy.StrategyException;
import edu.neu.cs6515.turn.ITurnProxy;
import edu.neu.cs6515.xml.Placement;
import edu.neu.cs6515.xml.Tile;
import edu.neu.cs6515.admin.Administrator;

/**
 * IPlayer is the interface for all players,
 * 
 * Temporal Logic: setPlayersInGameAndTilesInHand()+ makeYourTurn()*
 */
@SuppressWarnings("unused")
public interface IPlayer {

    /**
     * to set the names of player starting the game to the player
     * 
     * @param playersStartGame
     *            the names of players start the game
     */
    @Requires({ "playersStartGame != null",
                "playersStartGame.size() >= Administrator.getMinPlayers()",
                "playersStartGame.size() <= Administrator.getMaxPlayers()" })
    public abstract void setPlayersInGame(final List<String> playersStartGame);

    /**
     * Execute a complete turn
     * 
     * @param turnproxy
     *            to be used for placements
     */
    @Requires("turnproxy.getRequiredPlacements() == 1")
    @Ensures("turnproxy.getRequiredPlacements() == 0")
    public abstract void makeYourTurn(final ITurnProxy turnproxy) throws
            StrategyException;

    /**
     * inform the player of the last turn placements
     * 
     * @param placementsInLastTurn
     *            placement in last turn
     * @param playerName
     *            the name of the player taking last turn
     */
    @Requires({ "placementsInLastTurn.size() > 0", "playerName != null" })
    public abstract void recieveTurnBroadcast(
            final List<Placement> placementsInLastTurn,
            final String playerName);

    /**
     * inform the player that the registration succeeds
     * 
     * @param nbrOfPlayers
     *            total number of player will start the game
     * @param tiles
     *            initial tiles in player's hand
     */
    @Requires({ "nbrOfPlayers >= Administrator.getMinPlayers()",
            "nbrOfPlayers <= Administrator.getMaxPlayers()" })
    public abstract void registerAccepted(
            final int nbrOfPlayers,
            final List<Tile> tiles);

}